package org.lqq.controller;

import org.lqq.entity.Page;
import org.lqq.entity.Test;
import org.lqq.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by 李清泉 on 2017/12/12.
 *
 * @remark
 */
@Controller
public class TestController {
    @Autowired
    private StudentService studentService;


    @RequestMapping("/insert")
    public String insert(Test test){
        studentService.testinsert(test);
        return "redirect:/query";
    }
    @RequestMapping("/query")
    public String query(Test test,Model model){
        List<Test> list=studentService.query(test);
        model.addAttribute("list",list);
        Page page=new Page(test);
        model.addAttribute("page",page);
        return "test/test";
    }




}
